<dependency> <groupId>org.switchyard.components</groupId> <artifactId>switchyard-component-camel-sql</artifactId> <version>SWITCHYARD-VERSION</version> </dependency>
The sql binding in SwitchYard provides database read/write support for references in SwitchYard.
The file binding is built on top of camel-sql.
This binding have it's own namespace. To use it you must declare namespace with uri urn:switchyard-component-camel-sql:config:1.0. Your Maven project should also have following dependency:
<dependency> <groupId>org.switchyard.components</groupId> <artifactId>switchyard-component-camel-sql</artifactId> <version>SWITCHYARD-VERSION</version> </dependency>
Following options can be apiled to <binding.sql> definition:
query : SQL query to execute
dataSourceRef : data source name
batch : turn on JDBC batching
placeholder : a placeholder sign used to replace parameters in query
For detailed description of these parameters please visit camel-sql site.
Logically database is external resource from SwitchYard point of view. So there is no way to receive signals from database. To read data periodically please use SQL Binding together with Timer Binding or Quartz Binding.
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0"> <sca:reference name="GreetingDatabaseStore" promote="camel-binding/GreetingDatabaseStore" multiplicity="1..1"> <camel:binding.sql> <camel:query>INSERT INTO greetings (name) VALUES (#)</camel:query> <camel:dataSourceRef>java:jboss/datasources/GreetDS</camel:dataSourceRef> <camel:binding.sql> </sca:reference> <sca:reference name="GreetingDatabaseRetrieve" promote="camel-binding/GreetingDatabaseRetrieve" multiplicity="1..1"> <camel:binding.sql> <camel:query>INSERT INTO greetings (name) VALUES (#)</camel:query> <camel:dataSourceRef>java:jboss/datasources/GreetDS</camel:dataSourceRef> <camel:binding.sql> </sca:reference> </sca:composite>